//
//  BC_SplitPoint.h
//  CocOth
//
//  Created by BrunoCausse on 25/01/11.
//  Copyright 2011 poulailler cie. All rights reserved.
//

#import <Cocoa/Cocoa.h>

@class BC_Board;
@class BC_ZooRequest;
@class BC_Move;


@interface BC_SplitPoint : NSObject {
	
	BC_SplitPoint			*parent;
	
	BC_Board				*board;
	NSString				*descriptionForZoo;
	
	NSMutableArray			*moves;
	volatile int			nWorkers;
	
	NSInteger				alpha;
	NSInteger				beta;
	NSUInteger				cut;
    
	NSString                *bestMove;
	float					bestscore;
	float					time;
	NSString				*bestPV;
	
	NSCondition				*myCondition;
	
	NSLock					*registerLock;
	volatile int			stop;
	NSMutableArray			*children;

}

@property(readwrite, assign) NSInteger alpha, beta;
@property(readwrite, assign) float bestscore, time;
@property(readwrite, retain) NSString *bestMove, *bestPV; //copy ????

@property(readonly) volatile int stop;
@property(readonly) NSUInteger cut;

@property (readonly) BC_SplitPoint *parent;

@property (readonly) NSString *descriptionForZoo;

- (id)initWithBoard:(BC_Board *)aBoard
			  moves:(NSMutableArray *)arrayMoves
			  alpha:(NSInteger)alpha
			   beta:(NSInteger)beta
				cut:(NSUInteger)selectivity
			 parent:(BC_SplitPoint *)sp;

- (BC_Move *)nextMove;

- (void)should_stop;

- (void)wait;
- (void)signal;

- (BOOL)add:(id)child;
- (void)remove:(id)child;


@end
